﻿@model Poco.Table
           
@{
    //ViewData["Numero"] = items;
    ViewBag.Title = "Quel table voulez-vous servir?";
    Layout = "~/Views/Shared/_Layout_home.cshtml";

    //prepare la dropdownlist des categories
    List<SelectListItem> dropdown = new List<SelectListItem>();  
    
    if (ViewBag.tables != null)
    {
        foreach (Poco.Table t in ViewBag.tables)
        {
            dropdown.Add(new SelectListItem() { Text = t.Numero.ToString(), Value = t.Id.ToString() });
        }
    }
    else {
        dropdown.Add(new SelectListItem() { Text = "Aucune table", Value = "0" });
    }
}

<h2>Quel table voulez-vous servir?</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) 
{
    @Html.ValidationSummary(true)

        <div class="editor-label">
            @Html.Label("Numero de la table :")
        </div>
        <div class="editor-field">
        
        @Html.DropDownListFor(Model=>Model.Numero, dropdown)
           
        </div>

        <p>
            <input type="submit" value="Enregistrer" />
        </p>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
